#ifndef BUZZER_H
#define BUZZER_H

#include <QObject>
#include <QTimer>

class Buzzer : public QObject
{
    Q_OBJECT
public:
    enum{PWM_IOCTL_STOP=0,PWM_IOCTL_SET_FREQ=1};
    ~Buzzer();
    static Buzzer* Instance(){static Buzzer m_buzzer; return &m_buzzer; }
    void open_buzzer();
    void close_buzzer();
    void start_buzzer();
    void stop_buzzer();
    void set_freq(int freq);

protected:
    explicit Buzzer(int freq =20,QObject *parent = 0);
private:
    Buzzer( const Buzzer& );
    Buzzer& operator =(const Buzzer&);

signals:

private slots:
    void on_time();

private:
    int fd_buzzer;
    int frequency;
    QTimer *buzzer_timer;
};

#endif // BUZZER_H
